package com.hzhr.iot.device.service;

import com.hzhr.iot.core.annotation.ApiImplicitInternalParams;
import com.hzhr.iot.core.annotation.CygQuery;
import com.hzhr.iot.core.annotation.CygQuerys;
import com.hzhr.iot.core.annotation.CygService;
import com.hzhr.iot.core.constant.CommonOptions;
import com.hzhr.iot.core.exception.ServiceException;
import com.hzhr.iot.core.util.HzhrTypeUtil;
import com.hzhr.iot.device.convertor.custom.CollectDataCustomConvertor;
import com.hzhr.iot.device.dao.CollectDataDao;
import com.hzhr.iot.device.entity.CollectDataEntity;
import com.hzhr.iot.device.entity.ext.CollectDataEntityExt;
import com.hzhr.iot.device.model.collectData.CollectDataGetModel;
import com.hzhr.iot.device.model.collectData.CollectDataPostModel;
import com.hzhr.iot.device.queryModel.custom.CollectDataCustomQueryModel;
import com.hzhr.iot.device.service.base.BaseService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
@CygService(entity = CollectDataEntity.class)
@CygQuerys({
        @CygQuery(name = "_equal_id", query = "equal_id", type = Integer.class),
        @CygQuery(name = "_equal_collectDeviceId", query = "equal_collectDeviceId", type = Integer.class),
        @CygQuery(name = "_equal_collectDeviceCode", query = "equal_collectDeviceExt_code", type = String.class),
        @CygQuery(name = "_equal_currentTm", query = "equal_currentTm", type = Date.class),
        @CygQuery(name = "_greaterthanorequal_currentTm", query = "greaterthanorequal_currentTm", type = Date.class),
        @CygQuery(name = "_greaterthan_currentTm", query = "greaterthan_currentTm", type = Date.class),
        @CygQuery(name = "_lessthanorequal_currentTm", query = "lessthanorequal_currentTm", type = Date.class),
        @CygQuery(name = "_lessthan_currentTm", query = "lessthan_currentTm", type = Date.class),
        @CygQuery(name = "_orderBy_currentTm", query = "orderBy_currentTm", type = String.class),
        @CygQuery(name = "_equal_iotDeviceId", query = "equal_iotDeviceId", type = Integer.class),
        @CygQuery(name = "_isnull_alarmCodes", query = "isnull_alarmCodes", type = Boolean.class),
})
public class CollectDataService extends BaseService {
    @Autowired
    CollectDataCustomConvertor collectDataCustomConvertor;
    @Autowired
    CollectDataDao collectDataDao;
    @Autowired
    CollectDataService collectDataService;

    //region javadoc注释 : post
    /**
     * 新增采集数据 <br/><br/>
     * 简介 : 新增采集数据 <br/>
     * 步骤 : <br/>
     * 1. 新增采集数据 : (√) <br/>
     *  根据body新增采集数据(COLLECT_DATA)collectData_1； <br/>
     * 2. 返回信息 : (√) <br/>
     *  根据条件参数查询创建结果，组装响应并返回； <br/>
     * @param header <br/>
     * _token : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 令牌;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-code : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户代码;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-name : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户名;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-company-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 公司编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-dept-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 部门编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE');<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易流水号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易类型;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-access-mode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 访问模式 0:一般 1:全局;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 0;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/><br/>
     * @param query <br/>
     * _show_total : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示总数;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_info : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示详情;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/><br/>
     * @param body <br/><br/>
     * @throws ServiceException <br/>
     * @see CollectDataPostModel body <br/>
     * @see CollectDataGetModel result <br/>
     */ 
    //endregion
    //region 说明 : post
    //新增采集数据
    //简介 : 新增采集数据
    //步骤 :
    //1. 新增采集数据 : (√)
    // 根据body新增采集数据(COLLECT_DATA)collectData_1；
    //2. 返回信息 : (√)
    // 根据条件参数查询创建结果，组装响应并返回；
    //endregion
    //region 参数 : post
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),

    })
    //endregion
    //region 请求 : post
    @RequestMapping(value = "/collect-datas", method = RequestMethod.POST)
    //endregion
    @Transactional(rollbackFor = Exception.class)
    public CollectDataGetModel post(Map<String, String> header, Map<String, Object> query,
                                    CollectDataPostModel body) throws ServiceException {
        /* 新增采集数据 */
        CollectDataEntity collectData_1 = collectDataCustomConvertor.collectDataPostModel2entity(body);
        collectData_1.setIsValid(CommonOptions.YES_NO.YES);
        collectData_1.setCreateTime(new Date());
        collectData_1.setState("1");
        int changeCount = collectDataDao.insert(collectData_1);

        /* 返回信息 */
        query.put("_equal_id", collectData_1.getId());
        CollectDataGetModel result = collectDataService.get(initHeader(header), query);
        result.setChangeCount(changeCount);
        return result;
    }

    //region javadoc注释 : get
    /**
     * 查询采集数据 <br/><br/>
     * 简介 : 查询采集数据 <br/>
     * 步骤 : <br/>
     * 1. 查询采集数据 : (√) <br/>
     *  查询采集数据(COLLECT_DATA)； <br/>
     * 2. 返回信息 : (√) <br/>
     *  根据条件参数和查询到的结果组装响应并返回； <br/>
     * @param header <br/>
     * _token : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 令牌;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-code : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户代码;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-name : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户名;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-company-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 公司编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-dept-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 部门编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE');<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易流水号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易类型;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-access-mode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 访问模式 0:一般 1:全局;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 0;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/><br/>
     * @param query <br/>
     * _show : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 展示形式 one:展示一个,list:展示列表,null(空值):不展示;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _show_total : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示总数;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_info : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示详情;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_collectDevice : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示采集设备信息;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_ext : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示额外信息;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _page : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 页数;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 1;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _count : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 每页数量;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 1;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where collectData.id = #{_equal_id};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_collectDeviceId : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where collectData.collectDeviceId = #{_equal_collectDeviceId};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_collectDeviceCode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where collectData.collectDeviceCode = #{_equal_collectDeviceCode};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_currentTm : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where collectData.currentTm = #{_equal_currentTm};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : long;<br/>
     * _greaterthanorequal_currentTm : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where collectData.currentTm >= #{_greaterthanorequal_currentTm};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : long;<br/>
     * _greaterthan_currentTm : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where collectData.currentTm > #{_greaterthan_currentTm};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : long;<br/>
     * _lessthanorequal_currentTm : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where collectData.currentTm <= #{_lessthanorequal_currentTm};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : long;<br/>
     * _lessthan_currentTm : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where collectData.currentTm < #{_lessthan_currentTm};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : long;<br/>
     * _orderBy_currentTm : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : order by collectData.currentTm #{_orderBy_currentTm};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _equal_iotDeviceId : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where collectData.iotDeviceId = #{_equal_iotDeviceId};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _isnull_alarmCodes : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where collectData.alarmCodes is (not) null;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/><br/>
     * @throws ServiceException <br/>
     * @see CollectDataGetModel result <br/>
     */ 
    //endregion
    //region 说明 : get
    //查询采集数据
    //简介 : 查询采集数据
    //步骤 :
    //1. 查询采集数据 : (√)
    // 查询采集数据(COLLECT_DATA)；
    //2. 返回信息 : (√)
    // 根据条件参数和查询到的结果组装响应并返回；
    //endregion
    //region 参数 : get
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_collectDevice", value = "是否展示采集设备信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_ext", value = "是否展示额外信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_id", value = "筛选条件 : where collectData.id = #{equal_id}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_collectDeviceId", value = "筛选条件 : where collectData.collectDeviceId = #{equal_collectDeviceId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_collectDeviceCode", value = "筛选条件 : where collectData.collectDeviceCode = #{equal_collectDeviceCode}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_currentTm", value = "筛选条件 : where collectData.currentTm = #{equal_currentTm}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "greaterthanorequal_currentTm", value = "筛选条件 : where collectData.currentTm >= #{greaterthanorequal_currentTm}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "greaterthan_currentTm", value = "筛选条件 : where collectData.currentTm > #{greaterthan_currentTm}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "lessthanorequal_currentTm", value = "筛选条件 : where collectData.currentTm <= #{lessthanorequal_currentTm}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "lessthan_currentTm", value = "筛选条件 : where collectData.currentTm < #{lessthan_currentTm}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "orderBy_currentTm", value = "筛选条件 : order by collectData.currentTm #{orderBy_currentTm}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "equal_iotDeviceId", value = "筛选条件 : where collectData.iotDeviceId = #{equal_iotDeviceId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "isnull_alarmCodes", value = "筛选条件 : where collectData.alarmCodes is (not) null",required = false, dataType = "boolean", paramType = "query"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_collectDevice", value = "是否展示采集设备信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_ext", value = "是否展示额外信息", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_id", value = "筛选条件 : where collectData.id = #{_equal_id}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_collectDeviceId", value = "筛选条件 : where collectData.collectDeviceId = #{_equal_collectDeviceId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_collectDeviceCode", value = "筛选条件 : where collectData.collectDeviceCode = #{_equal_collectDeviceCode}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_currentTm", value = "筛选条件 : where collectData.currentTm = #{_equal_currentTm}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "_greaterthanorequal_currentTm", value = "筛选条件 : where collectData.currentTm >= #{_greaterthanorequal_currentTm}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "_greaterthan_currentTm", value = "筛选条件 : where collectData.currentTm > #{_greaterthan_currentTm}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "_lessthanorequal_currentTm", value = "筛选条件 : where collectData.currentTm <= #{_lessthanorequal_currentTm}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "_lessthan_currentTm", value = "筛选条件 : where collectData.currentTm < #{_lessthan_currentTm}",required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "_orderBy_currentTm", value = "筛选条件 : order by collectData.currentTm #{_orderBy_currentTm}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_equal_iotDeviceId", value = "筛选条件 : where collectData.iotDeviceId = #{_equal_iotDeviceId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_isnull_alarmCodes", value = "筛选条件 : where collectData.alarmCodes is (not) null",required = false, dataType = "boolean", paramType = "query"),

    })
    //endregion
    //region 请求 : get
    @RequestMapping(value = "/collect-datas", method = RequestMethod.GET)
    //endregion
    public CollectDataGetModel get(Map<String, String> header, Map<String, Object> query) throws ServiceException {
        /* 查询采集数据 */
        //生成查询模型
        CollectDataCustomQueryModel queryModel = collectDataCustomConvertor.collectDataService_query2queryModel(query);
        queryModel.setEqual_isValid(CommonOptions.YES_NO.YES);
        //查询实体
        List<CollectDataEntityExt> extList = null;
        String show = HzhrTypeUtil.object2string(query.get("_show"));
        if (!StringUtils.isEmpty(show)) {
            extList = collectDataDao.selectExtList(queryModel);
        }
        //查询数量
        Integer total = null;
        Boolean showTotal = HzhrTypeUtil.object2boolean(query.get("_show_total"));
        if (showTotal != null && showTotal) {
            total = collectDataDao.selectCount(queryModel);
        }

        /* 返回信息 */
        CollectDataGetModel result = collectDataCustomConvertor.extList2collectDataGetModel(extList, total, null, query);
        return result;
    }
}

